package com.blacktea.structuralpatterns.compositepattern.component;

import lombok.extern.slf4j.Slf4j;

import java.util.function.Consumer;

/**
 * @description: 叶子节点组件
 * @author: black tea
 * @date: 2023/3/22 18:08
 */
@Slf4j
public class Leaf<T> extends Component<T> {

    public Leaf(String name, Consumer<T> consumer) {
        super(name, consumer);
    }

    @Override
    public void operation(T data) {
        consumer.accept(data);
    }
}
